The present invention generally relates database management, and more particularly to optimization of database queries.
Mainstream database systems provide a relational data service (RDS). An RDS process parses a database query statement (hereinafter referred to as a query statement, or simply a query) and performs query semantic transformation (QST) according to the parsed results. Here, rewriting may also be performed on the query statement. Then, the RDS process may perform access path selection (i.e. APS evaluation) according to the QST processed query and generate an access specific language for an executive structure generator to generate execution structure. A database engine (or executive or execution modules thereof) will execute the query based on the executive/execution structure so as to obtain a query result.
Queries can be divided into simple and complex predicate queries. A predicate contains an argument, an operation relational operator or a logic operator and a constant in this order. When the variable does not contain a function, expression or sub-statement, the predicate is called a simple predicate. Complex predicates, by contrast, can contain a variable, a function, an expression, a sub-statement or the like. In a database language, relational operators or logic operators can comprise “=”, “>”, “>=”, “<”, “<=”, “NOT”, “IN”, “LIKE”, “BETWEEN”, or the like. Typical examples of simple predicates can include, but are not limited to, COL op values, COL IS NULL, COL IS NOT NULL, COL BETWEEN value1 AND value2, COL<>value, COL NOT BETWEEN value1 AND value2 and the like where the “op” represents “=”, “>”, “>=”, “<”, “<=” and “value”, “value1” and “value2” are constants.